<%--
  Created by IntelliJ IDEA.
  User: Windows10
  Date: 2021/4/13
  Time: 11:24
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script type="text/javascript">
    // $(function () {
    //     dataType : "jsonp",//数据类型为jsonp
    //         $("#but").click(function () {
    //             $.post("http://localhost:8080/ssmdemo_war/getAllUser",
    //                 function (data) {
    //                     console.log(data);
    //                     var html="";
    //                     for (let i=0;i<data.length;i++){
    //                         html +="<tr>"+
    //                             "<td>"+data[i].id+"</td>"+
    //                             "<td>"+data[i].username+"</td>"+
    //                             "<td>"+data[i].home+"</td>"+
    //                             "<td>"+"<a href=''>"+"修改"+"</a>"+"</td>"+
    //                             "<td>"+"<a href=''>"+"删除"+"</a>"+"</td>"+
    //                             "</tr>"
    //                     }
    //                     $("#content").html(html);
    //                 });
    //         })
    // });
    function an() {
        $.ajax({
            url:"http://localhost:8080/ssmdemo_war/login?uname="+$("#username").val()+"&pas="+$("#password").val(),
                success:function (data) {
                    if (data) {//根据返回值进行跳转
                        // alert($("#username").val()+"&pas="+$("#password").val())
                        window.location.href = "http://localhost:8081/client_war/success.jsp";
                    }
                    else{
                        // alert($("#username").val()+"&pas="+$("#password").val())
                        window.location.href = "http://localhost:8081/client_war/nologin.jsp";
                    }
                }
        })
    }
</script>
<body>
        <h3>欢迎登录</h3>
        <div class="input">
            <input type="text" id="username" name="username" placeholder="请输入登录名" >
        </div>
        <div class="input">
            <input type="password" id="password" name="password" placeholder="请输入密码" >
        </div>
        <input type="submit" id="bl"  value="登录" onclick="an()">
</body>
</html>
